// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_pr.p_activity;

import android.net.Uri;
import android.os.Handler;
import android.text.TextUtils;
import com.nnee.p_img.cls_d;
import com.nnee.p_pr.p_atom.cls_g;
import com.nnee.p_pr.p_atom.cls_u;
import com.nnee.p_pr.cls_v;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

// Referenced classes of package com.nnee.p_pr.p_activity:
//            fd, fc

public class cls_ed
{

    public cls_ed()
    {
        c = false;
        d = false;
        j = new Object();
        k = new ArrayList();
        l = new LinkedList();
        m = new HashMap();
        h = new cls_fd(this);
        i = null;
    }

    static void a(cls_ed ed1)
    {
        ed1.d();
    }

    static void a(cls_ed ed1, int i1)
    {
        ed1.c(i1);
    }

    static Handler b(cls_ed ed1)
    {
        return ed1.i;
    }

    private void c(int i1)
    {
        if(h != null)
            h.sendEmptyMessage(i1);
    }

    private boolean c()
    {
        if(k != null && !k.isEmpty())
        {
            Uri uri;
            synchronized(j)
            {
                uri = (Uri)k.remove(0);
            }
            StringBuilder stringbuilder = new StringBuilder();
            com.nnee.p_img.cls_d.a().a(stringbuilder, 2, uri.toString(), new cls_fc(this), f, g, 0, e);
        }
        return false;
       
    }

    private void d()
    {
        if(e() && !d)
        {
            c(1);
            d = true;
        } else
        {
            c();
        }
    }

    private boolean e()
    {
        Object obj = j;
    
        boolean flag;
        if(k.size() <= 0 && l.size() == 0)
            flag = true;
        else
            flag = false;
        return flag;
    }

    public int a(com.nnee.p_pr.p_prot.cls_d d1, boolean flag)
    {
    	
    	int j1 = k.size();
        Iterator iterator;
        cls_u u1;
        String s;
        String s1;
        List list;
        int i1;
        
        c = flag;
        synchronized(j)
        {
            k.clear();
            m.clear();
        }
        if(d1 == null || d1.h == null) {
        	 
             if(j1 > 0)
                 c(0);
             else
             if(c)
                 c(1);
             return j1;
        } else {
        	d = false;
            iterator = d1.h.iterator();
            while(true)
            {
            if(!iterator.hasNext()) {
            	 if(j1 > 0)
                     c(0);
                 else
                 if(c)
                     c(1);
                 return j1;
            } else {
            	 u1 = (cls_u)iterator.next();
                 if(!u1.v()) {continue;}else {
                	 s = u1.b(cls_g.fEConver);
                     if(!TextUtils.isEmpty(s))
                         synchronized(j)
                         {
                             k.add(Uri.parse(s));
                             m.put(u1.V(), s);
                         }
                     s1 = u1.b(cls_g.bEAlernate);
                     if(TextUtils.isEmpty(s1)) {continue;}else{
                    	 list = l;
                         
                         i1 = cls_v.a().a(s1, u1);
                         if(i1 > 0)
                             l.add(new Integer(i1));
                         continue;
                     }
                 }
            }
            }
        }
 
    }

    public void a()
    {
        if(k != null)
            k.clear();
        if(m != null)
            m.clear();
        if(h != null)
            h.removeCallbacksAndMessages(null);
    }

    public void a(int i1)
    {
        e = i1;
    }

    public void a(int i1, int j1)
    {
        f = i1;
        g = j1;
    }

    public void a(Handler handler)
    {
        i = handler;
    }

    public HashMap b()
    {
        return m;
    }

    public void b(int i1)
    {
        Integer integer = new Integer(i1);
        if(l.contains(integer))
        {
            synchronized(l)
            {
                l.remove(new Integer(i1));
            }
            if(e() && !d)
            {
                c(1);
                d = true;
            }
        }
        return;
       
    }

    static final int a = 0;
    static final int b = 1;
    private boolean c;
    private boolean d;
    private int e;
    private int f;
    private int g;
    private Handler h;
    private Handler i;
    private Object j;
    private List k;
    private List l;
    private HashMap m;
}
